package core.genetic.mutation;

import utility.*;
import core.*;
import core.genetic.*;

public class RandomGeneMutation implements HromozomMutation {
	
	public final double mutRatePop;
	
	public RandomGeneMutation(double mutRagePop) {
		this.mutRatePop = mutRagePop;
	}
	
	
	@Override
	public void mutate(Individual ind) {
		if (Utils.random.nextDouble() > mutRatePop)
			return;

		int len = ind.getLength();
		int i = Utils.random.nextInt(len);
		ind.setGene(i,Mode.mode.singleMutation.getMutated(ind.getGene(i)));		
	}
	
}